package main

import "encoding/json"

func Sum[T Number](vals ...T) T {
	var res T
	for _, val := range vals {
		res = res + val

	}
	return res

}

// 衍生类型
type Integer int

type Number interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

// 可以调用接口 [R 接口]
func ReleaseReource[R json.Marshaler](r R) {
	r.MarshalJSON()

}
